package com.hup.sidebar.framework.util;

import android.content.Context;
import android.os.IBinder;
import android.view.View;
import android.view.inputmethod.InputMethodManager;


/**
 * @author hugan
 * @date 2022/4/5
 */
public class SystemUtil {

    /**
     * @param view 可以是根布局本身
     */
    public static void hideKeyboard(View view) {
        InputMethodManager im = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        IBinder token = view.getWindowToken();
        im.hideSoftInputFromWindow(token, InputMethodManager.HIDE_NOT_ALWAYS);
    }

}
